package org.tity.test.entity.raw.sys;

import org.tity.sql.entity.EntitySet;
import org.tity.sql.data.Rcd;
import org.tity.sql.entity.Entity;
import javax.persistence.Table;
import org.tity.sql.entity.annotations.TableDesc;
import javax.persistence.Id;
import org.tity.sql.entity.annotations.IdGenerator;
import javax.persistence.Column;
import org.tity.sql.meta.DBTypeCategery;
import org.tity.sql.entity.annotations.ColumnDesc;
import org.tity.sql.dao.DAO;
import org.tity.test.entity.raw.sys.DictSet;
import org.tity.test.entity.raw.sys.Dict;
import org.tity.test.entity.raw.sys.UserSet;
import org.tity.test.entity.raw.sys.User;


/*
 * 此类代码为自动生成，请勿修改 !
 */

/**
 * 
 * @author tity-code-builder-powered-by-lifangjie
 * @date 2019-02-13 09:57:00
 **/
@javax.persistence.Entity
@Table(name="sys_dict_item")
@TableDesc("")
public class DictItem extends Entity {
	/**
	 * 用于按照当前实体指定参数集
	*/
	public static final String PARAM_NAMES="[$:allfields:org.tity.test.entity.raw.sys.DictItem:&]";
	/**
	 * 用于按照当前实体主键指定参数集
	*/
	public static final String PARAM_PK_NAMES="[$:pkfields:org.tity.test.entity.raw.sys.DictItem:&]";

	/**
	 * 构造函数(从数据库构建)
	*/
	public DictItem(EntitySet ownerSet,Rcd rcd) {
		super(ownerSet,rcd);
		super.logicValues=new Object[]{"Y","N"};
	}

	/**
	 * 构造函数(直接构建)
	*/
	public DictItem() {
		super(null,null);
		super.logicValues=new Object[]{"Y","N"};
	}

	/**
	 * 获取字段 id 的值<br/>
	 */
	@Id
	@IdGenerator(type=IdGenerator.SUID)
	@Column(name="id",nullable=false,length=50)
	@ColumnDesc(label="id",comment="id",internal=false,type=DBTypeCategery.string)
	public String getId() {
		return this.getValue("id",String.class);
	}

	/**
	 * 设置字段 id 的值<br/>
	 */
	public DictItem setId(String value) {
		super.setValue("id",value);
		return this;
	}

	/**
	 * 获取字段 dict_id 的值<br/>
	 */
	@Id
	@IdGenerator(type=IdGenerator.SUID)
	@Column(name="dict_id",nullable=false,length=50)
	@ColumnDesc(label="dict_id",comment="dict_id",internal=false,type=DBTypeCategery.string)
	public String getDictId() {
		return this.getValue("dict_id",String.class);
	}

	/**
	 * 设置字段 dict_id 的值<br/>
	 */
	public DictItem setDictId(String value) {
		super.setValue("dict_id",value);
		return this;
	}

	/**
	 * 获取字段 name 的值<br/>
	 */
	@Column(name="name",nullable=true,length=50)
	@ColumnDesc(label="name",comment="name",internal=false,type=DBTypeCategery.string)
	public String getName() {
		return this.getValue("name",String.class);
	}

	/**
	 * 设置字段 name 的值<br/>
	 */
	public DictItem setName(String value) {
		super.setValue("name",value);
		return this;
	}

	/**
	 * 获取字段 sort 的值<br/>
	 */
	@Column(name="sort",nullable=true,length=20)
	@ColumnDesc(label="sort",comment="sort",internal=false,type=DBTypeCategery.string)
	public String getSort() {
		return this.getValue("sort",String.class);
	}

	/**
	 * 设置字段 sort 的值<br/>
	 */
	public DictItem setSort(String value) {
		super.setValue("sort",value);
		return this;
	}

	/**
	 * 获取字段 memo 的值<br/>
	 */
	@Column(name="memo",nullable=true,length=200)
	@ColumnDesc(label="memo",comment="memo",internal=false,type=DBTypeCategery.string)
	public String getMemo() {
		return this.getValue("memo",String.class);
	}

	/**
	 * 设置字段 memo 的值<br/>
	 */
	public DictItem setMemo(String value) {
		super.setValue("memo",value);
		return this;
	}

	/**
	 * 生成并设置ID值
	*/
	@Override 
	public DictItem generateId() {
		super.generateIdInternal(null);
		return this;
	}

	/**
	 * 通过指定的DAO，生成并设置ID值
	*/
	@Override 
	public DictItem generateId(DAO dao) {
		super.generateIdInternal(dao);
		return this;
	}

	public Dict getOwnerDict() {
		return (Dict)this.getOneToOneRef("join-dict-on(local.dict_id=entity.id)");
	}

	public UserSet getAreaTypeUserSet() {
		return (UserSet)this.getOneToManyRef("join-user-on(local.id=entity.area_type)");
	}

	public UserSet getCardTypeUserSet() {
		return (UserSet)this.getOneToManyRef("join-user-on(local.id=entity.card_type)");
	}

}
